package com.example.back.controller;

import com.example.back.dto.req.DoDisableReq;
import com.example.back.dto.req.DoctorListReq;
import com.example.back.dto.req.PharmacistSave;
import com.example.back.dto.resp.PharmacisRsp;
import com.example.back.dto.resp.PharmacistInfoRsp;
import com.example.back.service.PharmacistService;
import com.example.common.support.Result;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * @Author wxy
 * @Date 2021/1/14 13:44
 * @Version 1.0
 */
@RestController
@Api(tags = "基础信息管理-药师管理")
@RequestMapping("/api/Pharmacist")
public class PharmacistController {

    @Resource
    private PharmacistService pharmacistService;

    @ApiOperation(value = "药师列表", notes = "药师列表")
    @PostMapping(value = "/List")
    public Result<PageInfo<PharmacisRsp>> List(@RequestBody DoctorListReq doctorListReq) {
        return Result.success(pharmacistService.List(doctorListReq));
    }

    @ApiOperation(value = "启用、禁用", notes = "启用、禁用")
    @PostMapping(value = "/DoDisable")
    public Result<Object> DoDisable(@RequestBody DoDisableReq doDisableReq) {
        return Result.success(pharmacistService.DoDisable(doDisableReq));
    }



    @ApiOperation(value = "详情", notes = "详情")
    @PostMapping(value = "/Info")
    public Result<PharmacistInfoRsp> Info(@RequestBody DoDisableReq doDisableReq) {
        return Result.success(pharmacistService.Info(doDisableReq));
    }

    @ApiOperation(value = "上传文件", notes = "上传文件")
    @PostMapping(value = "/UpLoad")
    public Result<HashMap<String,Object>> UpLoad(@RequestParam(value = "file") MultipartFile file) {
        return Result.success(pharmacistService.UpLoad(file));
    }

    @ApiOperation(value = "保存", notes = "保存")
    @PostMapping(value = "/Save")
    public Result<Object> Save(@RequestBody PharmacistSave pharmacistSave) {
        return Result.success(pharmacistService.Save(pharmacistSave));
    }
}
